﻿<!DOCTYPE html>

<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
<!-- saved from url=(0013)about:internet -->
<head>
    <meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=5,6,7,8,9,10,11, chrome=1" />
    <title>ECharts</title>
    <style>
        #main {
            width: 97%;
            height: 97%;
            position: absolute;
        }
    </style>
</head>

<body>
    <div id="main" />
    <script src="echarts.js"></script>
    <script>
        myChart = echarts.init(document.getElementById('main'));

        option = {
            legend: {
                orient: 'vertical',
                right: 10,
                top: 'center',
                data: []
            },
            series: [{
                type: 'pie',
                radius: '80%',
                center: ['50%', '50%'],
                data: [],
            }]
        };

        myChart.setOption(option);

        function jsShowHide(info) {
            if (info == 0) {
                myChart.clear();
            }
            else {
                myChart.setOption(option);
            }
        }
        function jsPushData(label, value) {
            var data = {};
            data.name = label;
            data.value = value;
            option.series[0].data.push(data);
            option.legend.data.push(label);
            myChart.setOption(option);
        }

        function jsShiftData(label, value) {
            option.series[0].data.shift();
            option.legend.data.shift();
            myChart.setOption(option);
        }

        function jsSetDatas(data) {
            option.series[0].data = JSON.parse(data);
            var arr1 = [];
            for (let i = 0; i < option.series[0].data.length; i++)
                arr1.push(option.series[0].data[i].name);
            option.legend.data = arr1;
            myChart.setOption(option);
        }

        function jsSetSize(x, y) {
            var main = document.getElementById('main')
            main.style.width = x + "px"
            main.style.height = y + "px"
            myChart.resize({ width: x, height: y });
        }

        function click1() {
            //var main = document.getElementById('main')
            //main.style.width = "500px"
            //main.style.height = "500px"
            //myChart.resize({ height: 500, width:500 });
            window.external.ShowMsg("这是一条信息,来自js，调用了C#");
        }

    </script>
</body>
</html>